import redis

# 连接数据库
r = redis.StrictRedis(host='127.0.0.1', port=6379, db=0, decode_responses=True, password='123456')

# 设置
print(r.sadd('set', 'a', 'b', 'c'))

# 获取
print(r.smembers('set'))

# 关闭
r.close()